DateTimeDayOfYear

 

Retrieves the day of the year from the given DateTime object.

 

int @DateTimeDayOfYear(object datetime);

 

Parameters

object datetime: The created DateTime object

 

Return Value

Returns the day of the year. January 1st is 1, January 31st is 31, February 1st is 32, and so on. December 31st can be 365 or 366 depending on the year.

 

Example

t = @DateTimeNow();
year = @DateTimeYear(t);
month = @DateTimeMonth(t);
day = @DateTimeDay(t);
hour = @DateTimeHour(t);
minute = @DateTimeMinute(t);
second = @DateTimeSecond(t);
millisecond = @DateTimeMillisecond(t);

dow = @DateTimeDayOfWeek(t);
doy = @DateTimeDayOfYear(t);

@sprintf(buf, "%d-%d-%d %02d:%02d:%02d.%03d dow=%d,doy=%d", year, month, day, hour, minute, second, millisecond, dow, doy);
@Message(buf);

 

Description: Gets the current time, creates a DateTime object, and reads each element to display it as a message.

 

Version Information

Supported Version: 10.3.0 or Higher

 

Related Helps

@DateTimeAddDays()

@DateTimeAddHours()

@DateTimeAddMilliseconds()

@DateTimeAddMinutes()

@DateTimeAddMonths()

@DateTimeAddSeconds()

@DateTimeAddYears()

@DateTimeDay()

@DateTimeDayOfWeek()

@DateTimeDayOfYear()

@DateTimeHour()

@DateTimeMillisecond()

@DateTimeMinute()

@DateTimeMonth()

@DateTimeNew()

@DateTimeNow()

@DateTimeSecond()

@DateTimeUtcNow()

@DateTimeYear()